# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-telegram-bot
_pkgname=python-telegram-bot
pkgver=21.6
pkgrel=0
pkgdesc="A Python wrapper around the Telegram Bot API"
url="https://github.com/python-telegram-bot/python-telegram-bot"
arch="noarch"
license="LGPL-3.0-or-later"
depends="py3-future py3-certifi py3-tornado py3-cryptography py3-decorator"
#checkdepends="pytest py-cffi py-cryptography py-future py-pathlib2"
options="!check" # few requirements-dev.txt packages missing in alpine
makedepends="py3-setuptools py3-gpep517 py3-hatchling"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/python-telegram-bot/python-telegram-bot/archive/v$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-telegram-bot" # Backwards compatibility
provides="py-telegram-bot=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
6f70f6c720a00ce3e48bfef6a729b03487bda99d1e3ef0ab69b75ab1b1044dd2143c83d17ac1846f335c5ec338513c534c020980d401e25ac27ca4b72473152f  py3-telegram-bot-21.6.tar.gz
"
